package anatex.web;

import anatex.domain.TaskLog;
import anatex.domain.Task;
import org.springframework.roo.addon.web.mvc.controller.RooWebScaffold;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestParam;

@RooWebScaffold(path = "tasklogs", formBackingObject = TaskLog.class, create=false, update=false, delete=false)
@RequestMapping("/tasklogs")
@Controller
public class TaskLogController {
	
	@RequestMapping(params = "find=ByTask", method = RequestMethod.GET)
    public String findTaskLogsByTask(@RequestParam("task") Task task, Model model) {
        model.addAttribute("tasklogs", TaskLog.findTaskLogsByTask(task).getResultList());
        model.addAttribute("task", task.getId());
        return "tasklogs/list";
    }
}
